<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取多个数中的最大值</title>
    <script>
        //面试题
        function b(x,y,a){
            arguments[2] = 10;
            //alert(a);
        }
        b(1,2,3);   //结果：10
        b(1,2);     //结果：undefined


        function  getMaxNum() {
            var maxNum = arguments[0];
            for(var i = 0; i < arguments.length ; i++){
                maxNum = maxNum > arguments[i] ? maxNum : arguments[i];
            }
            return maxNum;
        }

         console.log(getMaxNum(1,2,43,23,21,56,78));
    </script>
</head>
<body>

</body>
</html>